//
// Created by Administrator on 2021/1/30 0030.
//

#ifndef JQHMUSIC_CALLJAVA_H
#define JQHMUSIC_CALLJAVA_H

#include <jni.h>
#include <string>

#include "AndroidLog.h"

#define MAIN_THREAD 0
#define CHILD_THREAD 1
class CallJava {
public:
    _JavaVM *javaVM = NULL;
    JNIEnv  *jniEnv = NULL;
    jobject  jobj;
    jmethodID jmid_parpared;
    jmethodID jmid_load;
    jmethodID  jmid_timeinfo;
    jmethodID  jmid_error;
    jmethodID  jmid_complete;
    jmethodID  jmid_valumedb;
    jmethodID  jmid_pcmtoaac;
public:
    CallJava(JavaVM *javaVM, JNIEnv *env, jobject *obj);
    ~CallJava();

    void onCallParpared(int type);

    void onCallLoad(int type, bool load);

    void onCallTimeInfo(int type, int curr, int total);

    void onCallError(int type, int code, char *msg);

    void onCallComplete(int type);

    void onCallValumeDB(int type, int db);

    void onCallPcmToAAC(int type, int size, void *buffer);
};


#endif //JQHMUSIC_CALLJAVA_H
